Learn R Programming

via (version 0.2.0)

[<-,VirtualArray,ANY,ANY,logical-method: Replace layers in an object that is of a class derived from 'VirtualArray'.

Description

Single bracket '[' refers to indices and names within the 'VirtualArray'-class object. Use double brackets to replace layers based on their names (in the @stack). Object types of the same kind class can be used to replace values in 'XArray'-class objects. 'SpatRaster'-class objects can be used to replace values in 'RasterArray'-class objects. Classes inheriting from 'sf' can be used with 'SfArray'-class objects.

Usage

# S4 method for VirtualArray,ANY,ANY,logical
[(x, i, j, ...) <- value

# S4 method for RasterArray,ANY,ANY,SpatRaster [(x, i, j, ...) <- value

# S4 method for SfcArray,ANY,ANY,sfc [(x, i, j, ...) <- value

# S4 method for SfArray,ANY,ANY,sf [(x, i, j, ...) <- value

Value

The function has no return value.

Arguments

x

VirtualArray-class object.

i

subscript of the first dimension(rows) or vector-like subsetting.

j

subscript of the second dimension (columns).

...

subscript of additional dimensions.

value

A same class object as x.

Examples

Run this code
ex <- rastex() 
# replace third element with missing value
ex[3] <- NA
# duplicate first element and make it the second too
ex[2] <- ex[1]
ex

Run the code above in your browser using DataLab